using System.Collections.Generic;
using UnityEngine;

public class CareerLayer : UILayer
{
	public GameObject careerGroupButton;

	public UITable table;

	private void Awake()
	{
		Init();
	}

	protected void Init()
	{
		List<CareerSettings.CareerGroup> groups = ScriptableObjectSingleton<CareerSettings>.instance.groups;
		List<GameObject> list = new List<GameObject>();
		foreach (CareerSettings.CareerGroup item in groups)
		{
			CreateGroup(item, list);
		}
		int num = 0;
		foreach (GameObject item2 in list)
		{
			item2.name = GGFormat.IndexName(num);
			num++;
		}
		table.Reposition();
	}

	protected void CreateGroup(CareerSettings.CareerGroup group, List<GameObject> tableGameObjects)
	{
		GameObject gameObject = NGUITools.AddChild(table.gameObject, careerGroupButton);
		tableGameObjects.Add(gameObject);
		CareerGroupButton component = gameObject.GetComponent<CareerGroupButton>();
		component.Init(group);
	}
}
